const state = {
    userName: 'sujf'
}
const getter = {
    firstLetter: (state) => {
        return state.userName.substr(0,1)
    }
}
const mutations = {
    SET_USER_NAME (state, params){
        state.userName = params
    }
}

const actions = {
    //接收三个参数，1用来提交，2当前的state，3指store目录下的index中的state
    updateUserName({ commit, state, rootState, dispatch}){
        dispatch('xxx', '值') //用来提交下面的xxx
    },
    xxx(){
        // 空
    }
}
export default {
    getter,
    state,
    mutations,
    actions
}
